package virtualReader;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.LengthFieldBasedFrameDecoder;

public class VrChannelInitializer extends ChannelInitializer<SocketChannel> {
	private VirtualReader vr;

	public VrChannelInitializer(VirtualReader vr) {
		super();
		this.vr = vr;
	}

	@Override
	protected void initChannel(SocketChannel ch) throws Exception {
		ch.pipeline().addLast("decoder",new LengthFieldBasedFrameDecoder(4096,0,4,0,4));
        ch.pipeline().addLast("handler", new VirtualReaderHandler(vr)); 		
        
	}

}
